package com.oocl.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.oocl.pojo.Merchant;
import com.oocl.service.MerchantManager;
import com.oocl.service.factory.MerchantManagerFactory;

@WebServlet("/sec/toProcess")
public class ToProcessServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private MerchantManager manager;
	private Logger logger = Logger.getLogger(ToProcessServlet.class);
	
    public ToProcessServlet() {
        super();
        manager = MerchantManagerFactory.getInstance();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException {
		String mid = request.getParameter("mid");
		Merchant merchant = manager.findMerchantById(mid);
		request.setAttribute("merchant", merchant);
		request.getRequestDispatcher("../WEB-INF/views/process.jsp").forward(request, response);
		logger.info("to process page");
	}

}
